//canister.txt - A canister which teaches/improves a skill and then dies.
//Cell 0 - Skill to improve.
//Cell 1 - Amount to change. if 0, just increases by 1
// Cell 2,3 - Flag to increment by one when this canister is used

beginobjectscript; // learning canister

variables;
short been_used = 0;

body;

beginstate INIT_STATE;
	break;

beginstate DEAD_STATE;
	break;

beginstate START_STATE; 
	break;

beginstate 3; // running animation and death
	if (am_i_doing_action() == FALSE) {
		kill_object(ME,0); 
		}
break;

beginstate USE_STATE;
	if (been_used > 0)
		end();
	print_str_color("Open Canister: When you open the canister, the agents inside begin to",2);
	print_str_color("  act upon you. You feel yourself changing.",2);
	if (get_memory_cell(1) == 0)
		alter_stat(get_memory_cell(0),1);
		else alter_stat(get_memory_cell(0),get_memory_cell(1));
	run_sparkles_on_char(pc_num(),8,10,0);
	play_sound(161); 
	run_object_animation(4,0,35);
	inc_flag(100,22,1);
	if ((get_memory_cell(2) > 0) || (get_memory_cell(3) > 0)) {
		inc_flag(get_memory_cell(2),get_memory_cell(3),1);
		}
	been_used = 1;
	set_state(3);
break;
